package com.example.controller.project;

import com.example.entity.Project;
import com.example.service.projectResource.ProjectService;
import com.example.util.R;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * --- 无事发生 ---
 *
 * @author YangYiBo
 * @date 2024/12/7
 * @desc
 */
@RestController
@RequestMapping("/pr/project")
public class ProjectController {
    @Autowired
    private ProjectService projectService;

    /**
     * 模糊查询
     */
    @PostMapping("/list")
    public R list(@RequestBody Project project) {

        System.out.println(project);
        PageHelper.startPage(project.getPageNum(), project.getPageSize());

        List<Project> list = projectService.list(project);

        PageInfo<Project> pageInfo = new PageInfo(list);

        return R.ok(pageInfo);
    }
}
